package com.supermap.business.cloud.agrinfo.crop;

import com.alibaba.dubbo.config.annotation.Reference;
import com.supermap.dataservice.util.JSONUtils;
import com.supermap.dubbo.api.cloud.agrinfo.crop.CropService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

/**
 * @author aqua
 * @description 农情品种
 * @date 2018年11月08 下午 4:49
 * @email 1301584033@qq.com
 */
@Controller
@RequestMapping("/cloud/agrinfo/crop")
public class CropTypeController {
    @Reference(timeout = 100000)
    private CropService cropService;

    /**
     * 获取所有品种列表
     * */
    @RequestMapping("/getListCrop")
    @ResponseBody
    public List<Map<String,Object>> getListCrop(){
        return  cropService.getListCrop();
    }

    /**
     * 获取所有品种下面的种类列表
     * @param  cropId
     * */
    @RequestMapping("/getListCropChildNode")
    @ResponseBody
    public List<Map<String,Object>> getListCropChildNode(String cropId){
        return  cropService.getListCropChildNode(cropId);
    }

    /**
     * 根据专家的userid获取作物大类
     * @param expertUserId
     * @return
     */
    @GetMapping("getListCropByExperId")
    @ResponseBody
    public JSONUtils getListCropByExpertUserId(@RequestParam("expertUserId") Integer expertUserId)
    {
        return  cropService.getListCropByExpertId(expertUserId);
    }


}
